package org.opicasso.cheese.ui.pages;

import java.util.List;
import java.util.Locale;

import org.apache.wicket.markup.html.WebPage;
import org.opicasso.cheese.domain.Cart;
import org.opicasso.cheese.domain.Cheese;
import org.opicasso.cheese.domain.Customer;
import org.opicasso.cheese.ui.CheeseApplication;
import org.opicasso.cheese.ui.CheeseSession;
import org.opicasso.cheese.ui.components.CurrentDateLabel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class AbstractCheesePage extends WebPage {

	private static final long serialVersionUID = 369909906384738388L;
	protected Logger logger = LoggerFactory.getLogger(getClass());

	public AbstractCheesePage() {
		super();
		getSession().setLocale(new Locale("fr", "CA"));
		// current date
		add(new CurrentDateLabel("date"));
	}

	public CheeseSession getSession() {
		return (CheeseSession) super.getSession();
	}

	public Cart getCart() {
		return getSession().getCart();
	}

	public List<Cheese> getCheeses() {
		return CheeseApplication.get().getCheeses();
	}
	
	public Customer getCustomer() {
		return getSession().getCustomer();
	}

}
